package com.wiscamp.ninechapters.tags.infrastructure.converters;

import com.wiscamp.ninechapters.tags.domain.models.Course;
import com.wiscamp.ninechapters.tags.domain.models.CourseOutline;
import com.wiscamp.ninechapters.tags.infrastructure.po.CourseOutlinePO;
import com.wiscamp.ninechapters.tags.infrastructure.po.CourseOutlineView;
import com.wiscamp.ninechapters.tags.infrastructure.po.CoursePO;
import com.wiscamp.ninechapters.tags.infrastructure.po.CourseView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface CourseConverter {
    CourseConverter Instance = Mappers.getMapper(CourseConverter.class);

    // region course
    CoursePO toCoursePO(Course course);

    CoursePO toCoursePO(Course course, @MappingTarget CoursePO po);

    Course toCourse(CoursePO po);

    Course toCourseByView(CourseView view);
    // endregion

    // region outline
    CourseOutlinePO toCourseOutlinePO(CourseOutline courseOutline);

    CourseOutlinePO toCourseOutlinePO(CourseOutline courseOutline, @MappingTarget CourseOutlinePO po);

    CourseOutline toCourseOutline(CourseOutlinePO po);

    CourseOutline toCourseOutlineByView(CourseOutlineView view);
    // endregion
}
